module libeventd.rpc.Struct;

import
	libeventd.Types;

enum{
	EVRPC_STATUS_ERR_NONE		=0,
	EVRPC_STATUS_ERR_TIMEOUT	=1,
	EVRPC_STATUS_ERR_BADPAYLOAD	=2,
	EVRPC_STATUS_ERR_UNSTARTED	=3,
	EVRPC_STATUS_ERR_HOOKABORTED	=4,
}

extern(C):

struct evrpc_status {
	ev_int		 error;
	evhttp_request*	http_req;
}



struct evrpc {
	TAILQ_ENTRY!(evrpc)	next;
	char*			uri;

	void* function(void*)	request_new;
	void*				request_new_arg;
	void function(void*)		request_free;
	ev_int function(void*, evbuffer*)	request_unmarshal;

	void* function(void*)	reply_new;
	void*				reply_new_arg;
	void function(void*)		reply_free;
	ev_int function(void*)	reply_complete;
	void function(evbuffer*, void*)	reply_marshal;
	void function(evrpc_req_generic*,void*)	cb;
	void*			cb_arg;
	evrpc_base*		base;
}